﻿'Option Explicit On
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq

Public Class frmJson



    Private Sub frmJson_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Combobox As New DataGridViewComboBoxColumn
        Dim combotwo As New DataGridViewComboBoxCell

        Combobox.Items.AddRange("SI", "NO", "NINGUNO")
        combotwo.Items.AddRange("A", "B", "C", "D")
        combotwo.Items.AddRange()

        Me.DataGridView1.ColumnCount = 2
        'Me.DataGridView1.Columns.Add(Combobox)


        Me.DataGridView1.Columns(0).HeaderText = "Pregunta"
        Me.DataGridView1.Columns(1).HeaderText = "Respuesta"
        Me.DataGridView1.Columns(0).Width = 300
        Me.DataGridView1.Columns(1).Width = 100

        Me.DataGridView1.Columns(0).ReadOnly = True

        Me.DataGridView1.RowCount = 4

        Me.DataGridView1.Rows(0).Cells(0).Value = "Mano"
        Me.DataGridView1.Rows(0).Cells(1).Value = "Hola"
        'Me.DataGridView1.Rows(0).HeaderCell
        'Me.DataGridView1.Rows(0).Cells(1) = combotwo


    End Sub

    Public Class objRoot
        Public Property id As String
        Public Property respuesta As String
        Public Property respuestaOLP As String
        Public Property idOLP As String
    End Class

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



        'Dim strJson As String
        'strJson = "{'1':'20/20 (1,0)','2':'20/25 (0,8)','3':'20/30 (0,66)','4':'20/40 (0,5)','5':'20/50 (0,4)','6':'20/60 (0,33)','7':'20/70 (0,28)','8':'20/100 (0,2)','9':'20/200 (0,1)'}"

        'Dim objJson As New Object
        ''Dim deserializedProductcas As Object = JsonConvert.DeserializeObject(Of Object)(strJson)
        'objJson = JsonConvert.DeserializeObject(strJson)

        'MsgBox(objJson.Item("1").ToString)

        'EsperarShell("notepad.exe")
    End Sub

    Private proc As Process
    Private processes() As Process
    Private procName As String = "notepad"

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Dim itemAdd As ListViewItem
        'ListView1.Items.Clear()


        processes = Process.GetProcessesByName(procName)

        For Each proc In processes
            MsgBox(proc.ProcessName)
            'MsgBox(proc.)
            'itemAdd = ListView1.Items.Add(proc.MainWindowTitle)
            'itemAdd.SubItems.Add(proc.Id.ToString)
        Next
    End Sub

    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

    End Sub

    Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
        If e.ColumnIndex = 1 AndAlso e.RowIndex <> -1 Then

            Using gridBrush As Brush = New SolidBrush(Me.DataGridView1.GridColor), backColorBrush As Brush = New SolidBrush(e.CellStyle.BackColor)

                Using gridLinePen As Pen = New Pen(gridBrush)
                    ' Clear cell  
                    e.Graphics.FillRectangle(backColorBrush, e.CellBounds)

                    ' Draw line (bottom border and right border of current cell)  
                    'If next row cell has different content, only draw bottom border line of current cell  
                    'If e.RowIndex < DataGridView1.Rows.Count - 2 AndAlso DataGridView1.Rows(e.RowIndex + 1).Cells(e.ColumnIndex).Value.ToString() <> e.Value.ToString() Then
                    e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1)
                    'End If

                    ' Draw right border line of current cell  
                    e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom)

                    ' draw/fill content in current cell, and fill only one cell of multiple same cells  
                    If Not e.Value Is Nothing Then
                        If e.RowIndex > 0 AndAlso DataGridView1.Rows(e.RowIndex - 1).Cells(e.ColumnIndex).Value.ToString() = e.Value.ToString() Then
                        Else
                            e.Graphics.DrawString(CType(e.Value, String), e.CellStyle.Font, Brushes.Black, e.CellBounds.X + 2, e.CellBounds.Y + 5, StringFormat.GenericDefault)
                        End If
                    End If

                    e.Handled = True
                End Using
            End Using
        End If
    End Sub
End Class



